//
//  ZHNavigationBarController.m
//  XMLYFM
//
//  Created by dllo on 15/12/22.
//  Copyright © 2015年 zzl. All rights reserved.
//

#import "ZHNavigationBarController.h"

@interface ZHNavigationBarController ()

@end

@implementation ZHNavigationBarController

- (instancetype)initWithRootViewController:(UIViewController *)rootViewController{
    
    self = [super initWithRootViewController:rootViewController];
    if (self) {
        CGRect frame = self.navigationBar.frame;
        self.alphaView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height+20)];
        self.alphaView.backgroundColor = [UIColor clearColor];
        [self.view insertSubview:self.alphaView belowSubview:self.navigationBar];
        [self.navigationBar setBackgroundImage:[UIImage imageNamed:@"透明图.jpg"] forBarMetrics:UIBarMetricsCompact];
        self.navigationBar.layer.masksToBounds = YES;
    }
    return self;
}

- (void)setAlph{
    if (self.isChange == NO) {
        
        self.isChange = YES;
        if (self.alphaView.alpha == 0.0 ) {
            [UIView animateWithDuration:0.5 animations:^{
                self.alphaView.alpha = 1.0;
            } completion:^(BOOL finished) {
                self.isChange = NO;
            }];
        }else{
            [UIView animateWithDuration:0.5 animations:^{
                self.alphaView.alpha = 0.0;
            } completion:^(BOOL finished) {
                self.isChange = NO;
                
            }];
        }
    }

}


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
